﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BSCMFF.Core.DataAccessLayer;

namespace BSCMFF.Web.UserControls.Details
{
    /// <summary>
    /// Survey details.
    /// </summary>
    /// <remarks></remarks>
    public partial class SurveyDetails : System.Web.UI.UserControl
    {
        /// <summary>
        /// survey
        /// </summary>
        private Survey_Form _survey;
        /// <summary>
        /// Gets or sets the survey.
        /// </summary>
        /// <value>The survey.</value>
        /// <remarks></remarks>
        public Survey_Form Survey
        {
            get
            {
                return _survey;
                
            }
            set
            {
                _survey = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is edit mode.
        /// </summary>
        /// <value><c>true</c> if this instance is edit mode; otherwise, <c>false</c>.</value>
        /// <remarks></remarks>
        public bool IsEditMode { get; set; }


        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !IsEditMode)
            {
                foreach (Control c in this.Controls)
                {
                    if (c.GetType().Name == "RadTextBox")
                    {
                        c.Visible = false;
                        Label l = (Label)this.FindControl(c.ID.Replace("RadTextBox", "LabelCurrent"));
                        l.Visible = true;
                    }
                    if (c.GetType().Name == "RadNumericTextBox")
                    {
                        c.Visible = false;
                        Label l = (Label)this.FindControl(c.ID.Replace("RadNumericTextBox", "LabelCurrent"));
                        l.Visible = true;
                    }
                }
            }

        }
    }
}